import { connect, useParams } from "umi";
import {
  QueryFilter,
  ProFormText,
  ProFormSelect,
} from "@ant-design/pro-components";
const FilterForm = (props: any) => {
  const params = useParams();
  const { dictNameList, dispatch } = props;
  const searchForm = (params: any): any => {
    dispatch({
      type: "SystemDictipnaryDetail/queryTableDataInfoList",
      params,
    });
  };
  return (
    <QueryFilter<{
      name: string;
      company: string;
    }>
      defaultCollapsed={false}
      onFinish={searchForm}
      // onReset={() => searchForm(undefined)}
    >
      <ProFormSelect
        initialValue={params.dictType}
        name="dictType"
        label="字典名称"
        showSearch
        options={dictNameList}
      />
      <ProFormText
        name="dictLabel"
        label="字典标签"
        placeholder={"请输入字典类型"}
        rules={[{ max: 20 }]}
      />
      {/*<ProFormSelect*/}
      {/*  name="status"*/}
      {/*  label="状态"*/}
      {/*  placeholder={'字典状态'}*/}
      {/*  showSearch*/}
      {/*  valueEnum={{*/}
      {/*    0: '正常',*/}
      {/*    1: '停用',*/}
      {/*  }}*/}
      {/*/>*/}
    </QueryFilter>
  );
};

export default connect(({ SystemDictipnaryDetail }: any) => ({
  ...SystemDictipnaryDetail,
}))(FilterForm);
